package PTA_JAVA.JavaA.Javademo25;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Queue<Integer> a = new LinkedList<>();
        Queue<Integer> b = new LinkedList<>();
        for (int i = 0; i < n; i++) {
            int s = sc.nextInt();
            if(s%2!=0){
                a.add(s);
            }else{
                b.add(s);
            }
        }
        int f=0;
        while(!a.isEmpty() || !b.isEmpty()){
            if(!a.isEmpty()){
                if(f==0){
                    System.out.print(a.peek());
                    a.poll();
                    f=1;
                }else{
                    System.out.print(" "+a.peek());
                    a.poll();
                }
            }
            if(!a.isEmpty()){
                System.out.print(" "+a.peek());
                a.poll();
            }
            if(!b.isEmpty()){
                if(f==0){
                    System.out.print(b.peek());
                    b.poll();
                    f=1;
                }else{
                    System.out.print(" "+b.peek());
                    b.poll();
                }
            }
        }
    }
}
